home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / util / misc / AlertV10.lha / Alert.c next >
Encoding:
C/C++ Source or Header  |  1993-05-29  |  943 b   |  38 lines

  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include <intuition/intuition.h>
  4. #include <clib/intuition_protos.h>
  5. #include <clib/exec_protos.h>
  6. #include "Includes/MyAlert.h"
  7.  
  8. char const *version = "$VER: Alert V1.0 (28.05.93)";
  9.  
  10. struct IntuitionBase    *IntuitionBase;
  11.  
  12. main(int argc,char *argv[]) {
  13.     if(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",33)) {
  14.         if(argc<2 | strcmp(argv[1],"?")==0)
  15.             MyAlert(RECOVERY_ALERT,
  16.                             "Alert V1.0  © 1993 Ketil Hunn\n"
  17.                             "Usage: Alert TEXTLINE/M\n\n"
  18.                             "Each given parameter will appear as one line of text "
  19.                             "in the alert.");
  20.         else {
  21.             int i=0;
  22.             char    *text;
  23.  
  24.             if(text=malloc(2400)) {
  25.                 strcpy(text,argv[1]);
  26.                 for(i=2; i<argc; ++i) {
  27.                     strcat(text,"\n");
  28.                     strcat(text,argv[i]);
  29.                 }
  30.                 MyAlert(RECOVERY_ALERT,text);
  31.                 free(text);
  32.             } else 
  33.                 MyAlert(RECOVERY_ALERT,"Out of memory!");
  34.         }
  35.         CloseLibrary((struct Library *)IntuitionBase);
  36.     }
  37. }
  38.